package com.example.nacoscloudconsumer.controller;

import com.example.nacoscloudconsumer.service.MqService;
import com.example.nacoscloudconsumer.utils.Results;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;


@Slf4j
@RestController
@RequestMapping("mq")
public class MqController {

    @Autowired
    private MqService mqService;


    @RequestMapping("/sendMessage")
    public Map<String, Object> sendMessage(){
        try {
            mqService.sendMessage();
            return Results.success("请求成功");
        }catch (Exception e){
            log.error("sendMessage fail:{}", e);
            return Results.error(500, "请求失败");
        }
    }
}
